package com.situ.water_read.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.water_read.mapper.RdReadMapper;
import com.situ.water_read.pojo.RdTask;
import com.situ.water_read.mapper.RdTaskMapper;
import com.situ.water_read.service.RdTaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.situ.water_system.mapper.SyEmpMapper;
import com.situ.water_system.pojo.SyEmp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@Service
public class RdTaskServiceImpl extends ServiceImpl<RdTaskMapper, RdTask> implements RdTaskService {
    @Autowired
    RdTaskMapper mapper;
    @Autowired
    SyEmpMapper empMapper;
    @Autowired
    RdReadMapper readMapper;
    @Override
    public List<Map> querytask() {
        Calendar calendar = Calendar.getInstance();
        List<Map> map=mapper.querytask(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH)+1);
        return map;
    }

    @Override
    public List<SyEmp> queryEmpbylwt() {
        return mapper.queryEmpbylwt();
    }

    @Override
    public void addtask(RdTask task) {
        mapper.insert(task);
    }

    @Override
    public void updateread(RdTask task) {
        readMapper.updateread(task);
    }

    @Override
    public RdTask queryTaskId(QueryWrapper wrapper) {
        return mapper.selectOne(wrapper);
    }

    @Override
    public void updatetask(RdTask task) {
        mapper.updateById(task);
    }
}
